﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using DBUtil.MetaData;
using System.Linq;
using DBUtil.Generators;
using System.Collections.Concurrent;
using System.Threading;
using DBUtil.Expressions;
using DotNetCommon;
using Microsoft.Data.Sqlite;
using DotNetCommon.Extensions;

namespace DBUtil.Provider.SQLite
{
    /// <summary>
    /// Sqlite操作对象
    /// </summary>
    public partial class SqliteAccess : DBAccess
    {
        public override DBManage Manage => throw new NotImplementedException();

        public override IDataParameter CreatePara()
        {
            return new SqliteParameter();
        }

        public override string GetSqlForPageSize(string selectSql, string strOrder, int PageSize, int PageIndex)
        {
            throw new NotImplementedException();
        }

        public override bool JudgeProcedureExist(string procName)
        {
            throw new NotImplementedException();
        }

        public override bool JudgeTriggerExist(string triggerName)
        {
            throw new NotImplementedException();
        }

        public override long NewId(string tableName, string colName)
        {
            throw new NotImplementedException();
        }

        public override List<long> NewIds(string tableName, string colName, int count)
        {
            throw new NotImplementedException();
        }

        public override string NewSNO(string tableName, string colName, SerialFormat format)
        {
            throw new NotImplementedException();
        }

        public override List<string> NewSNOs(string tableName, string colName, SerialFormat format, int count)
        {
            throw new NotImplementedException();
        }

        public override void ResetId(string tableName, string colName)
        {
            throw new NotImplementedException();
        }

        public override void ResetSNO(string tableName, string colName)
        {
            throw new NotImplementedException();
        }

        protected override IDataAdapter CreateAdapter(IDbCommand cmd) => new SqliteDataAdapter(cmd as SqliteCommand);

        protected override IDbCommand CreateCommand() => new SqliteCommand();

        #region 获取刚插入的自增id的Sql语句
        /// <summary>
        /// 获取刚插入的自增id的Sql语句
        /// </summary>
        /// <param name="sequenceName">序列名称</param>
        /// <returns></returns>
        public override string GetInsertedId(string sequenceName = null)
        {
            return $"select last_insert_rowid();";
        }
        #endregion
    }
}
